//
//  GRXLoginRegistView.m
//  1-MushroomStreet-自定义tabbar
//
//  Created by xmg on 15/12/21.
//  Copyright © 2015年 grx. All rights reserved.
//

#import "GRXLoginRegistView.h"
#import "GRXFastBtn.h"
@interface GRXLoginRegistView()

@property (weak, nonatomic) IBOutlet GRXFastBtn *QQLgoin;

@property (weak, nonatomic) IBOutlet GRXFastBtn *WXLogin;

@property (weak, nonatomic) IBOutlet GRXFastBtn *SinaLgoin;


@end
@implementation GRXLoginRegistView

+ (instancetype)loginView{
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] firstObject];
}


+ (instancetype)fastLoginView{
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
}


- (void)awakeFromNib{
    
    UIImage *qqImage = [self addImage:[UIImage imageNamed:@"login_btn_qq_background"] toImage:[UIImage imageNamed:@"login_btn_qq"]];
    [self.QQLgoin setImage:qqImage forState:UIControlStateNormal];


    UIImage *wxImage = [self addImage:[UIImage imageNamed:@"login_btn_wx_background"] toImage:[UIImage imageNamed:@"login_btn_wx"]];
    [self.WXLogin setImage:wxImage forState:UIControlStateNormal];
    

    UIImage *sinaImage = [self addImage:[UIImage imageNamed:@"login_btn_sina_background"] toImage:[UIImage imageNamed:@"login_btn_sina"]];
    [self.SinaLgoin setImage:sinaImage forState:UIControlStateNormal];
}

- (UIImage *)addImage:(UIImage *)image1 toImage:(UIImage *)image2 {
    
   
    UIGraphicsBeginImageContext(CGSizeMake(60, 60));
    
    // Draw image1
    [image1 drawInRect:CGRectMake(0, 0, 60, 60)];
    
    // Draw image2
    [image2 drawInRect:CGRectMake(15, 15, 30, 30)];
    
    UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
    
    UIGraphicsEndImageContext();
        
    return resultingImage;
}



@end
